<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增订单信息')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-order-add">
            <div class="col-xs-12" >
                <div class="form-group" >
                    <label class="col-sm-3 control-label">客户：</label>
                    <div class="col-sm-8">
                        <select id="userId" name="userId" class="form-control m-b select2-multiple" th:with="userList=${userList}">
                            <option th:each="user : ${userList}" th:value="${user.userId}" th:text="${user.userPhone +'——'+ user.userName}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">品类名称：</label>
                    <div class="col-sm-8">
                        <input name="goodsName" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">品类价格：</label>
                    <div class="col-sm-8">
                        <input name="goodsPrice" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">真实价格：</label>
                    <div class="col-sm-8">
                        <input name="realPrice" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">积分：</label>
                    <div class="col-sm-8">
                        <input name="shoppingPoints" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">备注：</label>
                    <div class="col-sm-8">
                        <textarea name="remark" class="form-control"></textarea>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var prefix = ctx + "app/order"
        $("#form-order-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-order-add').serialize());
            }
        }

        $(function() {
            $('#userId').select2({
                placeholder: "请选择客户",
                allowClear: true
            });
        })
    </script>
</body>
</html>